package com.itheima.d14_extends_constructor.practice;

class Student extends People   {
    private String name;
    private int age;
    private String schoolName;

    public Student() {
        System.out.println("学生子类无参数构造器执行");
    }

    public Student(String name,int age ){
        this( name,age,"黑马程序员");
    }

    public Student (String name ,int age ,String schoolName){
//        this.name=name;
//        this.age=age; //这样写则调用的是Student类的成员变量，在Student类里没有name和age的getter、setter方法，因此获取到的都为默认值
        super(name,age); //这里调用的是父类People中的name和age
        this.schoolName=schoolName;
    }

    public String getSchoolName() {
        return schoolName;
    }

    public void setSchoolName(String schoolName) {
        this.schoolName = schoolName;
    }
}
